How city bakeries ensured the cookie didn’t crumble